home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / fpu_ae.zip / MATH.H < prev    next >
C/C++ Source or Header  |  1990-12-11  |  5KB  |  159 lines

  1. /*      MATH.H
  2.  
  3.         Mathematical Definition Includes
  4.  
  5.         Copyright (c) Borland International 1990
  6.         All Rights Reserved.
  7.         
  8. *****************************************************************
  9. *                                                               *
  10. *  corrected and adapted for use with fpu_ae.lib by Adolf Engl  *
  11. *  V1.0 (1990-13-11)                                            *
  12. *  Adolf Engl (c)  Barthgasse 9/18  A-1030  Wien   Austria      *
  13. *                                                               *
  14. *****************************************************************
  15.  
  16. */
  17.  
  18.  
  19. #if !defined( __MATH )
  20. #define __MATH
  21.  
  22.                          /* included 11/90 by AE */
  23. #define __FPU_AE_   10   /* VERSION 1.0 of fpu_ae.lib */
  24.  
  25. #define HUGE_VAL    1.189731495357231765E+4932
  26.  
  27. #define M_E             2.71828182845904523536
  28. #define M_LOG2E         1.44269504088896340736
  29. #define M_LOG10E        0.434294481903251827651
  30. #define M_LN2           0.693147180559945309417
  31. #define M_LN10          2.30258509299404568402
  32. #define M_PI            3.14159265358979323846
  33. #define M_PI_2          1.57079632679489661923
  34. #define M_PI_4          0.785398163397448309116
  35. #define M_1_PI          0.318309886183790671538
  36. #define M_2_PI          0.636619772367581343076
  37. #define M_1_SQRTPI      0.564189583547756286948
  38. #define M_2_SQRTPI      1.12837916709551257390
  39. #define M_SQRT2         1.41421356237309504880
  40. #define M_SQRT_2        0.707106781186547524401
  41.  
  42. double  fabs( double x );
  43. double  ceil( double x );
  44. double  floor( double x );
  45. double  round( double x );
  46. double  trunc( double x );
  47. double  fmod( double x, double y );
  48.  
  49. double  exp( double x );
  50. double  log( double x );
  51. double  log10( double x );
  52.  
  53. double  frexp( double x, int *nptr );
  54. double  ldexp( double x, int n );
  55. double  modf( double x, double *nptr );
  56.  
  57. double  pow( double x, double y );
  58. double  pow10( int i );
  59. double  sqrt( double x );
  60.  
  61. double  cos( double x );
  62. double  sin( double x );
  63. double  tan( double x );
  64. void    sincos( double x, double *sin, double *cos );
  65.  
  66. double  acos( double x );
  67. double  asin( double x );
  68. double  atan( double x );
  69. double  atan2( double x, double y );
  70. double  cosh( double x );
  71. double  sinh( double x );
  72. double  tanh( double x );
  73.  
  74. double  acosh( double x );
  75. double  asinh( double x );
  76. double  atanh( double x );
  77.  
  78. /*** "ftoa" is not supported by fpu_ae.lib V1.0 ***/
  79. int     ftoa( double *x, char *resStr, int ndig, int format,
  80.               int *decPnt, int *sign );   
  81.  
  82. /* included 11/90 by AE */
  83. char    *ecvt( double d, int ndig, int *dec, int *sign ); 
  84.  
  85. double  atof( const char *digStr );
  86.  
  87.  
  88. typedef enum
  89. {
  90.          DOMAIN = 1,    /* argument domain error -- log (-1)      */
  91.          SING,          /* argument singularity  -- pow (0,-2))   */
  92.          OVERFLOW,      /* overflow range error  -- exp (1000)    */
  93.          UNDERFLOW      /* underflow range error -- exp (-1000)   */
  94. } mexcep;
  95.  
  96. struct exception
  97. {
  98.     mexcep      type;
  99.     char        *name;
  100.     double      arg1;
  101.     double      arg2;
  102.     double      retval;
  103. };
  104.  
  105. /*** "setmatherr" is not supported by fpu_ae.lib V1.0 ***/
  106. void    setmatherr( int (*errorfunc)( struct exception *e ) );
  107.  
  108. int     fpumode( int disable );   /* not supported by fpu_ae.lib V1.0 */
  109.  
  110. void    xdcnv( double *val, void *rep8bytes );
  111. void    dxcnv( void *rep8bytes, double *val );
  112.  
  113. #if defined( __68881__ ) && !defined( __NFPUIN__ )
  114.                                               /* MC68881 extensions */
  115. /* Arithmetische Befehle: */
  116. #define fabs( x )       __FABS__( x )
  117. #define fgetexp( x )    __FGETEXP__( x )
  118. #define fgetman( x )    __FGETMAN__( x )
  119. #define fint( x )       __FINT__( x )
  120. #define fintrz( x )     __FINTRZ__( x )
  121. #define trunc(x)        __FINTRZ__( x )       /* included 11/90 by AE */
  122. #define fmod( x, y )    __FMOD__( y, x )      /* changed 11/90 by AE */
  123. #define frem( x, y )    __FREM__( y, x )      /* changed 11/90 by AE */
  124. #define ldexp( x, y )   __FSCALE__( y, x )    /* changed 11/90 by AE */
  125. #define fsgldiv( x, y ) __FSGLDIV__( y, x )   /* changed 11/90 by AE */
  126. #define fsglmul( x, y ) __FSGLMUL__( y, x )   /* changed 11/90 by AE */
  127.  
  128. /* Potenzen und Logarithmen: */
  129. #define exp( x )        __FETOX__( x )
  130. #define fetoxm1( x )    __FETOXM1__( x )
  131. #define log( x )        __FLOGN__( x )
  132. #define flognp1( x )    __FLOGNP1__( x )
  133. #define log10( x )      __FLOG10__( x )
  134. #define log2( x )       __FLOG2__( x )
  135. #define sqrt( x )       __FSQRT__( x )
  136. #define pow10( x )      __FTENTOX__( x )
  137. #define pow2( x )       __FTWOTOX__( x )
  138. #define pow( x, y )     exp(log(x) * (y))
  139.  
  140. /* Trigonometrie: */
  141. #define acos( x )       __FACOS__( x )
  142. #define asin( x )       __FASIN__( x )
  143. #define atan( x )       __FATAN__( x )
  144. #define cos( x )        __FCOS__( x )
  145. #define sin( x )        __FSIN__( x )
  146. #define tan( x )        __FTAN__( x )
  147.  
  148. /* Hyperbelfunktionen: */
  149. #define atanh( x )      __FATANH__( x )
  150. #define cosh( x )       __FCOSH__( x )
  151. #define sinh( x )       __FSINH__( x )
  152. #define tanh( x )       __FTANH__( x )
  153.  
  154. #endif
  155.  
  156. #endif
  157.  
  158. /************************************************************************/
  159.